package com.fanqiechaodan.state;

/**
 * @author fanqiechaodan
 * @Classname Demo
 * @Description 状态模式
 */
public class Demo {

    public static void main(String[] args) {
        // 静止状态
        Context context = new Context();
        context.move();
        context.attack();
        // 移动状态
        context.setState(new MoveState());
        context.move();
        context.attack();
        // 攻击状态
        context.setState(new AttackState());
        context.move();
        context.attack();
    }
}
